<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>TimeSales Demo (English)</title>

<link href="../../../common/common.css" type="text/css" rel="stylesheet" />
<link href="../../../ui/dragdrop/dragdrop.css" type="text/css" rel="stylesheet" />
<link href="../../../ui/datagrid/datagrid.css" type="text/css" rel="stylesheet" />
<link href="../../../ui/scrollpanel/scrollpanel.css" type="text/css" rel="stylesheet" />
<link href="../../../ui/selectbutton/selectbutton.css" type="text/css" rel="stylesheet" />
<link href="../../../ui/dropdownlist/dropdownlist.css" type="text/css" rel="stylesheet" />
<link href="../../../widgets/autocomplete/autocomplete.css" type="text/css" rel="stylesheet" />
<link href="../../../widgets/timesales/timesales.css" type="text/css" rel="stylesheet" />
<link href="../../../theme/default/style.css" type="text/css" rel="stylesheet" />
</head>
<body>
	<div>
		<span>Push Connection:</span><span id="status"></span>
	</div>
	<br>
	<div class="sdk-timesales-container"></div>
	<br>
	<br>
	<div id="container2"></div>
	
	<script type="text/javascript" src="../../../lib/jquery.js"></script>
	<script type="text/javascript" src="../../../lib/jquery.mousewheel.js"></script>
	<script type="text/javascript" src="../../../lib/jquery.json.min.js"></script>
	<script type="text/javascript" src="../../../core/common.js"></script>
	<script type="text/javascript" src="../../../core/permissionChecker.js"></script>
	<script type="text/javascript" src="../../../core/tickers.js"></script>
	<script type="text/javascript" src="../../../core/subscriber.js"></script>
	<script type="text/javascript" src="../../../core/dataHandler.js"></script>
	<script type="text/javascript" src="../../../core/pull.js"></script>
	<script type="text/javascript" src="../../../core/push.js"></script>
	<script type="text/javascript" src="../../../core/SDKDataManager.js"></script>


	<script src="../../../formatter/qs_formatter_en_us.js" type="text/javascript"></script>
	<script src="../../../language/en_us/qs_timesales_en_us.js" type="text/javascript"></script>

	<script type="text/javascript" src="../../../common/common.js"></script>
	<script type="text/javascript" src="../../../ui/util/util.js"></script>
	<script type="text/javascript" src="../../../ui/dragdrop/dragdrop.js"></script>
	<script type="text/javascript" src="../../../ui/scrollpanel/scrollpanel.js"></script>
	<script type="text/javascript" src="../../../ui/datagrid/datagrid.js"></script>
	<script type="text/javascript" src="../../../ui/dropdownlist/dropdownlist.js"></script>
	<script type="text/javascript" src="../../../ui/selectbutton/selectbutton.js"></script>

	<script type="text/javascript" src="../../../widgets/timesales/timesales.js"></script>
	<script type="text/javascript" src="../../../widgets/autocomplete/autocomplete.js"></script>
	<script type="text/javascript" src="../../../theme/default/style.js"></script>
	
	<script type="text/javascript">
		$(document).ready(function() {
				QSAPI.init('DISN');
				QSAPI.Authentication.login("511F1BFFABACF2797D53014B7B7EF29F502E7015781E8D93A04989A70197E422B9AC0FE2E59882CDC9713E118EEA680F7F0E859C73FBD6BEF64C7DD04490EF1A",
					"62D2A0641B01FBF65FA127365CDC0DC427458A67D958FC979718FF067CCD1A8D8D4E839255D60957C1A502D25C724A1D65F6EEE07636A0AA84E8F51C8D1831EE", {
						onSuccess : function(result) {
							QSAPI.DataManager.connectToPull("http://qsstage.morningstar.com/pullservice/pull/getPullQuote.jsp", 5000, {
								onSuccess : function(eventType) {
									$("#status").text("Successfully")
									TimeSales();
								},
								onFailure : function(eventType, err) {
									$("#status").text("Fail")
								}
							});
						}
				});
		});

		function TimeSales() {
			QSAPI.TickerFactory.create([ "IBM" ], {
				onSuccess : function(tickerList) {
					var container = $(".sdk-timesales-container");
					var option = {
						queryBox : {
							show : true,
							buttonText:'Go'
						},
						filterBox : {
							show : true,
							buttonText:'Go'
						},

						width : 900,
						height : 300,
						fixHeight : true
					};
					var callbacks = {
						afterAcceptTicker : function() {
							console.log("afterAcceptTicker invoked.");
						},
						onLoad : function() {
							console.log("onLoad invoked.");
						},
						onHeightChange : function() {
							console.log("onHeightChange invoked.");
						},
					};
					var id = 'quote_' + Util.IdProducer.getId();

					var tickerObject = tickerList[0];
					var timesales = new QSAPI.Widget.TimeSales(container,
							option, callbacks, id);
					timesales.init();
					timesales.acceptTicker(tickerObject);

					$(window).bind('resize', function(e) {
						//timesales.changeOutSize(container.width(),container.height()-headHeight);
					});
				}
			});
		};
	</script>

</body>
</html>